import type { App } from 'vue';

declare module '@vue/runtime-core' {
  interface ComponentCustomProperties {
    $filters: any
  }
}
import JsonExcel from 'vue-json-excel'


//element-plus ui
import ElementPlus from 'element-plus';
import 'element-plus/dist/index.css';

//i18n 国际化
import i18n from '@/language/i18n';

//全局过滤器
import * as filters from '@/filters';

//初始化全局指令
import initDirective from './directive';

//element plus 二次封装
import LeeElementPlus from '@/components/packages/index';

//初始化语言
import zh from 'element-plus/es/locale/lang/zh-cn';
import en from 'element-plus/es/locale/lang/en';
const languageJson = {
  zh, en
};
import { storage } from '@/utils';
const locale = storage.getLocal('language');

//code展示组件
import Code from '@/components/Code/index.vue';


export default (app: App<Element>) => {
  app.use(ElementPlus, { locale: languageJson[locale] });//注入element-plus ui
  app.use(i18n);//注入国际化
  app.config.globalProperties.$filters = filters;//全局属性 增加过滤
  initDirective(app);//增加全局指令
  app.use(LeeElementPlus); //element plus 二次封装
  app.component(Code.name, Code);
  app.component('downloadExcel', JsonExcel)
};